package com.bokesoft.yigo.mid.service.example1;

import java.util.ArrayList;

import com.bokesoft.yigo.common.util.TypeConvertor;
import com.bokesoft.yigo.mid.base.DefaultContext;
import com.bokesoft.yigo.mid.document.LoadFormData;
import com.bokesoft.yigo.mid.service.IExtService;
import com.bokesoft.yigo.struct.datatable.DataTable;
import com.bokesoft.yigo.struct.document.Document;
/**
   *  对应Example4DBOpt表单，点击按钮，通过OID载入表单数据
 * @author ljd
 *
 */
public class LoadExample4Service implements IExtService {
	//new LoadFormData(formKey, oid)->Document-(Example4Head)->DataTable
	@Override
	public Object doCmd(DefaultContext context, ArrayList<Object> paras) throws Throwable {
		String formKey = TypeConvertor.toString(paras.get(0));
		long oid = TypeConvertor.toLong(paras.get(1));
		LoadFormData load = new LoadFormData(formKey, oid);
		Document document = load.load(context, null);
		DataTable dt = document.get("Example4Head");
		String s = dt.getString("NO");
		return s;
	}

}
